package org.moyrax.nereyda.services.factory
{
	import flash.utils.getQualifiedClassName;
	
	public class ClassFactory
	{
		public function getClassAlias( spec:Class ):String
		{
			var className  :String = getQualifiedClassName( new spec(null) );
			var classMatch :Array  = className.match(/(?:\:\:.*)/);
			
			if ( !classMatch.length ) {
				className = null;
			}
			else {
				className = classMatch[0].toString().replace(/\:\:/, "");
			}
			
			return( className );
		}

		// Devuelve una instancia única de la clase.
		//
		private static var instance :ClassFactory = null;
		
		public static function getInstance():ClassFactory
		{
			if ( instance == null )
				instance = new ClassFactory();
			
			return( instance );
		}
	}
}